import React from 'react';

export interface IAuthorizationContext {
  prefixCls: string;
  authGranDispatch: React.Dispatch<any>;
  stepsIndex: number;
  leftSearchValue: string;
  leftSelectKeys: string[];
  leftExpandedKeys: string[];
  autoExpandParent: boolean;
  leftTreeCheckRows: Record<string, any>[];
  rightSearchValue: string;
  // detailInfoData: Record<string, any>
  firstLeftTreeKeys: string[];
  firstRightListRows: Record<string, any>[];
  secondMenuOpenKeys: string[];
  secondMenuCheckKeys: string[];
  secondLeftSearValue: string;
  secondRightSearchValue: string;
  secondSaveIdList: any;
  threeLeftSearValue: string;
  threeMenuCheckKeys: string[];
  threeMenuOpenKeys: string[];
  threeSaveIdList: any;
  threeRightSearchValue: string;
  roleAuthDetailInfo: Record<string, any>;
}

const INIT_AUTHGRAN_VALUE: IAuthorizationContext = {
  prefixCls: '',
  authGranDispatch: () => {},
  stepsIndex: 0,
  leftSearchValue: '',
  leftSelectKeys: [],
  leftExpandedKeys: [],
  autoExpandParent: false,
  leftTreeCheckRows: [],
  rightSearchValue: '',
  // detailInfoData: {},
  firstLeftTreeKeys: [],
  firstRightListRows: [],
  secondMenuOpenKeys: [],
  secondMenuCheckKeys: [],
  secondLeftSearValue: '',
  secondRightSearchValue: '',
  secondSaveIdList: null,
  threeLeftSearValue: '',
  threeMenuCheckKeys: [],
  threeMenuOpenKeys: [],
  threeSaveIdList: null,
  threeRightSearchValue: '',
  roleAuthDetailInfo: {},
};

export const AuthorizationContext =
  React.createContext<IAuthorizationContext>(INIT_AUTHGRAN_VALUE);
